﻿// =================================================================== 
// 项目说明
//====================================================================
// 文件： ERP_Cargo_Detail.cs
// 创建时间：2016/11/21
// 负责人：
// ===================================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using CRMMis.Model;
using CRMMis.IDAL;


namespace MSSQLDAL
{
    /// <summary>
    /// 数据层实例化接口类  商品价格详情表.
    /// </summary>
    public partial class ERP_Cargo_DetailDAL : IERP_Cargo_DetailDAL
    {
		//此处写查询数据的sql语句，


        //if QueryDataString==""，DAL层的GetList，GetRecordCount等函数将直接存取ERP_Cargo_Detail表


        //if QueryDataString!=""，则DAL层的GetList，GetRecordCount等函数将存取该SQL语句，取代表
		//注意：所写sql语句执行结果的字段必须是唯一的

		private const string QueryDataString = @"select a.*,
                b.CargoName,
                b.Spell,
                b.ByName,
                b.CargoCode,
                b.Spec,
                b.Version,
                b.ProduceName,
                b.Area,
                c.SupplyName,
                (select TYPE_NAME from ERP_Type where TYPE_ID=b.TypeId )  TypeName,
                (select Use_NAME from ERP_Use where Use_ID=b.UseId )  UseNAME,
                d.USER_NAME InuserNAME,e.USER_NAME DELNAME
                FROM ERP_Cargo_Detail a 
                INNER JOIN ERP_Cargo b ON a.CargoId=b.CargoId
                LEFT JOIN ERP_Supply c ON a.SupplyId=c.SupplyID
                LEFT JOIN SYS_USER d ON a.Inuser=d.USER_ID
                LEFT JOIN SYS_USER e on a.DelUser=e.USER_ID";
    }
}
